Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Source Freshness Results #437

Open
wants to merge 26 commits into
base: main
Choose a base branch
from

Conversation

dpguthrie
Copy link
Contributor

Overview

This PR adds source freshness executions to the package. This was recently added into dbt-core and now if the user opts into this behavior (adding a specific flag in their dbt_project.yml file), the Results object will be populated with SourceFreshnessResults. The behavior is very similar to all of the other _executions tables/models.

Update type - breaking / non-breaking

  • Minor bug fix
  • Documentation improvements
  • Quality of Life improvements
  • New features (non-breaking change)
  • New features (breaking change)
  • Other (non-breaking change)
  • Other (breaking change)
  • Release preparation

What does this solve?

#166

Outstanding questions

The schema is slightly different than all of the other _executions tables. Happy to change that, it just seemed that 1) some of the info wasn't relevant and 2) there's additional info we need to capture.

What databases have you tested with?

  • Snowflake
  • Google BigQuery
  • Databricks
  • Spark
  • N/A

@dpguthrie dpguthrie had a problem deploying to Approve Integration Tests July 14, 2024 21:17 — with GitHub Actions Failure
@dpguthrie dpguthrie had a problem deploying to Approve Integration Tests July 14, 2024 21:17 — with GitHub Actions Failure
@dpguthrie dpguthrie had a problem deploying to Approve Integration Tests July 14, 2024 21:17 — with GitHub Actions Failure
@dpguthrie dpguthrie had a problem deploying to Approve Integration Tests July 14, 2024 21:17 — with GitHub Actions Failure
@dpguthrie dpguthrie changed the title Add Source Freshness Add Source Freshness Results Jul 14, 2024
@michelley-an michelley-an had a problem deploying to Approve Integration Tests August 20, 2024 17:50 — with GitHub Actions Failure
@michelley-an michelley-an temporarily deployed to Approve Integration Tests August 20, 2024 17:50 — with GitHub Actions Inactive
@michelley-an michelley-an had a problem deploying to Approve Integration Tests August 20, 2024 17:50 — with GitHub Actions Failure
@michelley-an michelley-an had a problem deploying to Approve Integration Tests August 20, 2024 17:50 — with GitHub Actions Failure
@dpguthrie dpguthrie had a problem deploying to Approve Integration Tests August 21, 2024 16:15 — with GitHub Actions Failure
@dpguthrie dpguthrie temporarily deployed to Approve Integration Tests August 21, 2024 16:15 — with GitHub Actions Inactive
@dpguthrie dpguthrie had a problem deploying to Approve Integration Tests August 21, 2024 16:15 — with GitHub Actions Failure
@dpguthrie dpguthrie had a problem deploying to Approve Integration Tests August 21, 2024 16:15 — with GitHub Actions Failure
Copy link
Member

@llifoawing llifoawing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @dpguthrie - need to add some logic to handle cases when warn_after or error_after configs are not set.

'{{ source.node.name }}', {# name #}
'{{ source.node.source_name }}', {# source_name #}
'{{ source.node.loaded_at_field }}', {# loaded_at_field #}
{{ source.node.freshness.warn_after.count }}, {# warn_after_count #}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{{ source.node.freshness.warn_after.count }}, {# warn_after_count #}
{{ 'null' if source.node.freshness.warn_after.count is none else source.node.freshness.warn_after.count }}

Was throwing an error when warn after not provided

'{{ source.node.source_name }}', {# source_name #}
'{{ source.node.loaded_at_field }}', {# loaded_at_field #}
{{ source.node.freshness.warn_after.count }}, {# warn_after_count #}
'{{ source.node.freshness.warn_after.period }}', {# warn_after_period #}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'{{ source.node.freshness.warn_after.period }}', {# warn_after_period #}
{% if source.node.freshness.warn_after.period is none %} null {% else %} '{{ source.node.freshness.warn_after.period }}' {% endif %}, {# warn_after_period #}

Handle None values

'{{ source.node.loaded_at_field }}', {# loaded_at_field #}
{{ source.node.freshness.warn_after.count }}, {# warn_after_count #}
'{{ source.node.freshness.warn_after.period }}', {# warn_after_period #}
{{ source.node.freshness.error_after.count }}, {# error_after_count #}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{{ source.node.freshness.error_after.count }}, {# error_after_count #}
{{ 'null' if source.node.freshness.error_after.count is none else source.node.freshness.error_after.count }}, {# error_after_count #}

Handle None values

{{ source.node.freshness.warn_after.count }}, {# warn_after_count #}
'{{ source.node.freshness.warn_after.period }}', {# warn_after_period #}
{{ source.node.freshness.error_after.count }}, {# error_after_count #}
'{{ source.node.freshness.error_after.period }}', {# error_after_period #}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'{{ source.node.freshness.error_after.period }}', {# error_after_period #}
{% if source.node.freshness.error_after.period is none %} null {% else %} '{{ source.node.freshness.error_after.period }}' {% endif %}, {# error_after_period #}

Handle None value

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants